<?php

namespace App\Http\Controllers\Agency;
use App\Services\ExamineService;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use hg\apidoc\annotation as Apidoc;
/**
 * 实名认证
 * @Apidoc\Group("examine")
 */
class RealController extends Controller
{
    /**
     * @Apidoc\Title ("实名认证")
     * @Apidoc\Url("/agency/realAuthList")
     * @Apidoc\Method("POST")
     * @Apidoc\Header("Authorization", type="string",require=true, desc="Bearer + accessToken")
     * @Apidoc\Param("page",type="int",require=true,desc="页数")
     * @Apidoc\Param("pageSize",type="int",require=true,desc="条数")
     * @Apidoc\Param("id",type="int",require=false,desc="用户id")
     * @Apidoc\Param("username",type="string",require=false,desc="用户昵称")
     * @Apidoc\Param("mobile",type="string",require=false,desc="用户手机号")
     * @Apidoc\Param("gender",type="string",require=false,desc="用户性别")
     * @Apidoc\Param("flag",type="string",require=false,desc="实名认证状态wait：待审核；pass：通过；refuse：未通过")
     * @Apidoc\Returned("id",type="int",require=false,desc="用户id"),
     * @Apidoc\Returned("base",type="object",require=false,desc="用户基本信息"),
     * @Apidoc\Returned("idcard",type="string",require=false,desc="身份证号"),
     * @Apidoc\Returned("paperimg1",type="string",require=false,desc="身份证号正面照片"),
     * @Apidoc\Returned("paperimg2",type="string",require=false,desc="身份证号反面照片"),
     * @Apidoc\Returned("paperimg3",type="int",require=false,desc="身份证号手持照片"),
     * @Apidoc\Returned("flag",type="int",require=false,desc="实名认证状态wait：待审核；pass：通过；refuse：未通过"),
     **/
    public function realAuthList(Request $request , ExamineService $examineService)
    {
        $params = $request->input();
        $params['aid'] = $this->getAid();
        $result = $examineService->realAuthList($params);
        return $this->responseSuccess($result);
    }

    /**
     * @Apidoc\Title ("实名认证-更新状态")
     * @Apidoc\Url("/agency/realAuthStatusUpdate")
     * @Apidoc\Method("POST")
     * @Apidoc\Header("Authorization", type="string",require=true, desc="Bearer + accessToken")
     * @Apidoc\Param("ids",type="int",require=true,desc="列表id 1,2,4")
     * @Apidoc\Param("flag",type="string",require=true,desc="wait待审核；pass通过；refuse未通过")
     * @Apidoc\Returned("true",type="bool",desc="保存状态")
     *
     */

    public function realAuthStatusUpdate(Request $request , ExamineService $examineService)
    {
        $params = $request->input();
        $result = $examineService->realAuthStatusUpdate($params);
        if($result)
            return $this->responseSuccess($result);
        else
            return $this->responseError(400);
    }
}
